package sh.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import sh.pojo.Man;


@RestController  //@ResponseBody和@Controller的组合注解。
public class HelloController01 {
    @Value("${company1}")
    private String company1;

    @Value("${company2}")
    private String company2;

    @RequestMapping("hello")//get请求
    public String hello() {
        return "hello spring boot!" + company1 + company2;
    }

    @Value("${person.name}")
    private String name;

    @Value("${address[1]}")
    private String address;


    @GetMapping("/getValue")
    private void getValue() {

        System.out.println("name = " + name);
        System.out.println("address[1] = " + address);
    }

    @Autowired
    private Man man;

    @GetMapping("/getMan")
    private Man man() {
        return man;
    }
}
